import type {
  DictionaryEncoSaveOrUpdateParams,
  DictionaryGroupSaveOrUpdateParams,
} from '@/types'

export const formRules = {
  name: [
    {
      required: true,
      message: '名称不能为空！',
      trigger: 'change',
    },
  ],
  dicKey: [{ required: true, message: '字典KEY不能为空!', trigger: 'blur' }],
  dicValue: [{ required: true, message: '字典VALUE不能为空！' }],
  dicCode: [
    { required: true, message: '字典分组编号不能为空!', trigger: 'blur' },
  ],
  dicName: [{ required: true, message: '字典分组名称不能为空！' }],
}

export const defaultFormData: Partial<DictionaryEncoSaveOrUpdateParams> = {
  dicCode: '',
  dicKey: '',
  dicValue: '',
}
export const defaultGroupFormData: Partial<DictionaryGroupSaveOrUpdateParams>
  = {
    dicName: '',
    dicCode: '',
    parentId: null as any,
    parentCode: '',
  }
